package com.solution.replace;

public class Solution {

    public boolean isValid(String s) {
        while ( s.contains("()") || s.contains("[]") || s.contains("{}") ){
            s = s.replace("()", "")
                    .replace("[]", "")
                    .replace("{}", "");
        }
        return s.length() == 0;
    }
}
